package com.example.domain.entity;

import javax.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 满减规则实体类
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "threshold_discount_rules")
public class ThresholdDiscountRule extends SoftDeleteEntity {

    @Id
    @Column(name = "id", length = 26)
    private String id;

    @Column(name = "rule_id", length = 26, nullable = false)
    private String ruleId;

    @Column(name = "threshold_amount", precision = 18, scale = 4, nullable = false)
    private BigDecimal thresholdAmount;

    @Column(name = "discount_amount", precision = 18, scale = 4, nullable = false)
    private BigDecimal discountAmount;

    @Column(name = "stackable", columnDefinition = "TINYINT(1) DEFAULT 0")
    private Boolean stackable = false;
    
    /**
     * 满减门槛是否使用原价判断
     * true=基于原价判断
     * false=基于折后价判断
     */
    @Column(name = "threshold_use_original_price", columnDefinition = "TINYINT(1) DEFAULT 0")
    private Boolean thresholdUseOriginalPrice = false;
}

